
let num = $this.model.table_1686721309239_rV4Px.length;
if (num > 0) {
    for (let i = 0; i < num; i++) {
        let id = $this.$util.uuid(); // 表单id
        let no = $this.$util.uuid(); // 表单no
        let headData = $this.model; // 表头数据
        let bodyData = $this.model.table_1686721309239_rV4Px[i]; // 表体数据
        let yafaxiangmubianhao="";
        let yaxiangmumingc= "";
        if(headData.select_1755083309463_mHEPo=="78b5ab7e1f44c0e77332c3d50fe0953a"){//
            yafaxiangmubianhao=headData.input_1755400042491_AneEL;
            yaxiangmumingc=headData.input_1755400042491_XgVKe;
        }else if(headData.select_1755083309463_mHEPo=="e733a9ce065437a0b87d1ff5760d6fa9"){
            yafaxiangmubianhao=headData.input_1755399989290_eozTY;
            yaxiangmumingc=headData.input_1755399989290_fjTf1;
        }else {
            yafaxiangmubianhao="";
            yaxiangmumingc="";
        }

        let huiyixzhi="";
        if(headData.select_1755083309463_mHEPo=="7040b6d1d27a07038906edf4bad2d563"){
            huiyixzhi="部门例会";
        }else if (headData=="78b5ab7e1f44c0e77332c3d50fe0953a"){
            huiyixzhi="研发例会";
        }else if (headData=="2f0c460c1db562176970c13bce21baa0"){
            huiyixzhi="技术评审";
        }else if (headData=="e733a9ce065437a0b87d1ff5760d6fa9"){
            huiyixzhi="项目例会";
        }else if (headData=="b6fe51845b65d2f331f765cb22f48a4c"){
            huiyixzhi="技术讨论";
        }else if (headData=="92172bc6267d0e59ba3abdf590f9c0aa"){
            huiyixzhi="专项会议";
        }
        else {
            huiyixzhi="其它";
        }


        //钉钉消息推送【字段不是必填项】
        let urlDing = $this.$util.getAPI_URL();
        let formDataDing=new FormData();
        formDataDing.append("userIds",bodyData["body_1686723308700_94zpy_ID"]);//执行人Id 字符串','拼接
        formDataDing.append("taskName",bodyData["body_1686722446764_sENx8"]);//任务名称
        formDataDing.append("distributor",headData.create_user_name);//派发人
        formDataDing.append("planDate",[headData.create_date,bodyData["body_1686722508108_T7rDA"].format("YYYY-MM-DD HH:mm:ss")]);//任务计划时间
        urlDing = urlDing.replace("api", "task/dingMessagePush");
        $this.$http.post(urlDing,formDataDing).then((res) => {
            if(res.data.code===280){
                $this.$message.success("钉钉消息推送成功")
            }else {
                $this.$message.errr("系统错误，请联系管理员!!!");
            }
        })


        let temp = `
                会议名称:${headData.input_1755079051083_wkd3M}
                会议日期:${headData.datepicker_1755149263127_x6DKy.format("YYYY-MM-DD")}
                会议地点:${headData.input_1755083285383_B9QLK}
                会议性质:${huiyixzhi}
                参会人:${headData.systemSelect_1755083720351_O64Ge}
                事项:${bodyData["body_1686722446764_sENx8"]}
                备注:${bodyData["body_1755083789357_tVg6P"] || "" }
        `

        let saveObj  ={
            "bill_id": id,
            "create_user_id": headData.create_user_id,
            "create_user_name": headData.create_user_name,
            "create_dept_name": headData.create_dept_name,
            "bill_type": headData.bill_type,
            "create_dept_id": headData.create_dept_id,
            "bill_no":no,
            "create_company_name":  headData.create_company_name,
            "create_date": headData.create_date,
            "create_company_id": headData.create_company_id,
            "number_1711439316655_41L04": 0,//计划工时 x
            "number_1711439319768_Hzhsj": 0,//文档数量 x
            "systemSelect_1711504973428_U0If2": headData.create_user_name,//派发人
            "systemSelect_1711504973428_U0If2_ID":headData.create_user_id,//派发人ID
            "number_1711505160101_Zy3nM": 0,//任务进度 x
            "number_1711505281945_eUZOr":0,//里程碑序号 x
            "input_1711505283971_PgltR": "false",//里程碑 x
            "number_1711505313898_96ND4": "0",//任务累计工时 x
            "input_1711518795031_xvIfW": "1",//任务状态 x
            "systemSelect_1711520339026_rFF5K": headData.create_company_id,//派发部门
            "systemSelect_1711520339026_rFF5K_ID": headData.create_company_id,//派发部门id
            "select_1711505903223_YWk8w": "e0f13da9d1df4bd692518af8430845fe",//任务类型(研发关联问题)
            "input_1751171983502_E4gXx": 0,//计划项目编号 x
            "input_1718345101976_ZNGth":  yafaxiangmubianhao,//项目编号
            "selectStr_1718345029613_IWjr8": yaxiangmumingc,//选择项目立项
            "selectStr_1718345029613_IWjr8_ID":0,//选择项目立项ID
            "input_1718345101976_PBcTl":  yaxiangmumingc,//会议名称
            "input_1711439260720_6QPqX": bodyData["body_1686722446764_sENx8"],//任务名称
            "rangePicker_1711439307444_Ftzhm": [headData.create_date,bodyData["body_1686722508108_T7rDA"].format("YYYY-MM-DD HH:mm:ss")],//计划时间
            "systemSelect_1711439400905_v5lzI": headData.systemSelect_1754972784687_XGxnj,//审核人
            "systemSelect_1711439400905_v5lzI_ID": headData["systemSelect_1754972784687_XGxnj_ID"],//审核人ID
            "systemSelect_1711439399614_qXQ72":bodyData["body_1686723308700_94zpy"],//负责人ID//
            "systemSelect_1711439399614_qXQ72_ID":bodyData["body_1686723308700_94zpy_ID"],//负责人ID
            "input_1711505193468_UJHDS":bodyData["body_id"],//ID
            "input_1711520372633_i4sGc":headData.create_date,//派发时间
            "textarea_1755766219698_SuIuk":temp
        }

        let formDataH = new FormData()
        formDataH.append("billId",headData.bill_id); //【注：表头id】
        const isRes = await $this.$http.post("/formsBusiness/gethyjyStatus/",formDataH)
        if (isRes.data.code === 280 && isRes.data.data === 2) {
            let files = []
            let formData = new FormData()
            formData.append('obj', JSON.stringify(saveObj))
            formData.append("files", JSON.stringify(files))
            $this.$http.post("/wind/form/save/" + "task" + "/" + "add", formData).then(res => {
                let data = res.data.data
            }).catch(e => {
                $this.$message.error(e.message);
            });
        }
    }
}


//最新版本
let num = $this.model.table_1686721309239_rV4Px.length;
if (num > 0) {
    for (let i = 0; i < num; i++) {
        let id = $this.$util.uuid(); // 表单id
        let no = $this.$util.uuid(); // 表单no
        let headData = $this.model; // 表头数据
        let bodyData = $this.model.table_1686721309239_rV4Px[i]; // 表体数据
        let yafaxiangmubianhao="";
        let yaxiangmumingc= "";
        if(headData.select_1755083309463_mHEPo=="78b5ab7e1f44c0e77332c3d50fe0953a"){//
            yafaxiangmubianhao=headData.input_1755400042491_AneEL;
            yaxiangmumingc=headData.input_1755400042491_XgVKe;
        }else if(headData.select_1755083309463_mHEPo=="e733a9ce065437a0b87d1ff5760d6fa9"){
            yafaxiangmubianhao=headData.input_1755399989290_eozTY;
            yaxiangmumingc=headData.input_1755399989290_fjTf1;
        }else {
            yafaxiangmubianhao="";
            yaxiangmumingc="";
        }

        let huiyixzhi="";
        if(headData.select_1755083309463_mHEPo=="7040b6d1d27a07038906edf4bad2d563"){
            huiyixzhi="部门例会";
        }else if (headData=="78b5ab7e1f44c0e77332c3d50fe0953a"){
            huiyixzhi="研发例会";
        }else if (headData=="2f0c460c1db562176970c13bce21baa0"){
            huiyixzhi="技术评审";
        }else if (headData=="e733a9ce065437a0b87d1ff5760d6fa9"){
            huiyixzhi="项目例会";
        }else if (headData=="b6fe51845b65d2f331f765cb22f48a4c"){
            huiyixzhi="技术讨论";
        }else if (headData=="92172bc6267d0e59ba3abdf590f9c0aa"){
            huiyixzhi="专项会议";
        }
        else {
            huiyixzhi="其它";
        }



        let temp = `
                会议名称:${headData.input_1755079051083_wkd3M}
                会议日期:${headData.datepicker_1755149263127_x6DKy.format("YYYY-MM-DD")}
                会议地点:${headData.input_1755083285383_B9QLK}
                会议性质:${huiyixzhi}
                参会人:${headData.systemSelect_1755083720351_O64Ge}
                事项:${bodyData["body_1686722446764_sENx8"]}
                备注:${bodyData["body_1755083789357_tVg6P"] || "" }
        `

        let saveObj  ={
            "bill_id": id,
            "create_user_id": headData.create_user_id,
            "create_user_name": headData.create_user_name,
            "create_dept_name": headData.create_dept_name,
            "bill_type": headData.bill_type,
            "create_dept_id": headData.create_dept_id,
            "bill_no":no,
            "create_company_name":  headData.create_company_name,
            "create_date": headData.create_date,
            "create_company_id": headData.create_company_id,
            "number_1711439316655_41L04": 0,//计划工时
            "number_1711439319768_Hzhsj": 0,//文档数量
            "systemSelect_1711504973428_U0If2": headData.create_user_name,//派发人
            "systemSelect_1711504973428_U0If2_ID":headData.create_user_id,//派发人ID
            "number_1711505160101_Zy3nM": 0,//任务进度
            "number_1711505281945_eUZOr":0,//里程碑序号
            "input_1711505283971_PgltR": "false",//里程碑
            "number_1711505313898_96ND4": "0",//任务累计工时
            "input_1711518795031_xvIfW": "1",//任务状态
            "systemSelect_1711520339026_rFF5K": headData.create_company_id,//派发部门
            "systemSelect_1711520339026_rFF5K_ID": headData.create_company_id,//派发部门id
            "select_1711505903223_YWk8w": "e0f13da9d1df4bd692518af8430845fe",//任务类型(研发关联问题)
            "input_1751171983502_E4gXx": 0,//计划项目编号
            "input_1718345101976_ZNGth":  yafaxiangmubianhao,//项目编号
            "selectStr_1718345029613_IWjr8": yaxiangmumingc,//选择项目立项
            "selectStr_1718345029613_IWjr8_ID":0,//选择项目立项ID
            "input_1718345101976_PBcTl":  yaxiangmumingc,//会议名称
            "input_1711439260720_6QPqX": bodyData["body_1686722446764_sENx8"],//任务名称
            "rangePicker_1711439307444_Ftzhm": [headData.create_date,bodyData["body_1686722508108_T7rDA"].format("YYYY-MM-DD HH:mm:ss")],//计划时间
            "systemSelect_1711439400905_v5lzI": headData.systemSelect_1754972784687_XGxnj,//审核人
            "systemSelect_1711439400905_v5lzI_ID": headData["systemSelect_1754972784687_XGxnj_ID"],//审核人ID
            "systemSelect_1711439399614_qXQ72":bodyData["body_1686723308700_94zpy"],//负责人ID//
            "systemSelect_1711439399614_qXQ72_ID":bodyData["body_1686723308700_94zpy_ID"],//负责人ID
            "input_1711505193468_UJHDS":bodyData["body_id"],//ID
            "input_1711520372633_i4sGc":headData.create_date,//派发时间
            "textarea_1755766219698_SuIuk":temp,
            "status":2
        }
        let formDataH = new FormData()
        formDataH.append("billId",headData.bill_id); //【注：表头id】
        $this.$http.post("/formsBusiness/gethyjyStatus/",formDataH).then((res) => {
            let isRes=res
            console.log("归档后才能下推 = ",isRes);
            if (isRes.data.code === 280 && isRes.data.data === 2) {
                console.log("isRes.data.code = ",isRes.data.code ,"isRes.data.data = ",isRes.data.data);
                let files = []
                let formData = new FormData()
                formData.append('obj', JSON.stringify(saveObj))
                formData.append("files", JSON.stringify(files))
                $this.$http.post("/wind/form/save/" + "task" + "/" + "add", formData).then(res => {
                    let data=res.data.data

                    //钉钉消息推送【字段不是必填项】
                    let urlDing = $this.$util.getAPI_URL();
                    let formDataDing=new FormData();
                    formDataDing.append("userIds",bodyData["body_1686723308700_94zpy_ID"]);//执行人Id 字符串','拼接
                    //formDataDing.append("projectName",$this.model["input_1718345101976_PBcTl"]);//项目名称
                    formDataDing.append("taskName",bodyData["body_1686722446764_sENx8"]);//任务名称
                    formDataDing.append("distributor",headData.create_user_name);//派发人
                    formDataDing.append("planDate",[headData.create_date,bodyData["body_1686722508108_T7rDA"].format("YYYY-MM-DD HH:mm:ss")]);//任务计划时间
                    urlDing = urlDing.replace("api", "task/dingMessagePush");
                    $this.$http.post(urlDing,formDataDing).then((res) => {
                        if(res.data.code===280){
                            $this.$message.success("钉钉消息推送成功")
                        }else {
                            $this.$message.errr("系统错误，请联系管理员!!!");
                        }
                    })

                }).catch(e => {
                    $this.$message.error(e.message);
                });
            }
        })
    }
}